package cn.kgc.service.impl;

/*
 *@author zhangtao
 *@Date 2023/4/27
 */

import cn.kgc.bean.pojo.EpDangerous;
import cn.kgc.mapper.EpDangerousMapper;
import cn.kgc.service.EpDangerousService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;


@Service("epDangerous")
public class EpDangerousServiceImpl implements EpDangerousService {

    @Resource
    private EpDangerousMapper epDangerousMapper;

    /*
     *@author zhangtao
     *@Date 2023/4/27
     * 隐患录入(新增隐患)
     */
    @Override
    public boolean addEpDangerous(EpDangerous epDangerous) {
        int count = epDangerousMapper.addEpDangerous(epDangerous);
        if (count > 0) {
            return true;
        } else {
            return false;
        }
    }

    /*
     *@author zhangtao
     *@Date 2023/4/27
     * 隐患管理(分页展示隐患)
     */
    @Override
    public List<EpDangerous> getAllEpDangerousInfo() {
        return epDangerousMapper.getAllEpDangerousInfo();
    }

    /*
     *@author zhangtao
     *@Date 2023/4/27
     * 隐患管理(删除隐患)
     */
    @Override
    public boolean delEpDangerousInfoById(Integer id) {
        int count = epDangerousMapper.delEpDangerousInfoById(id);
        if (count>0){
            return true;
        }else {
            return false;
        }
    }

    /*
     *@author zhangtao
     *@Date 2023/4/27
     * 隐患管理(修改隐患)
     */
    @Override
    public boolean updateEpDangerousInfo(EpDangerous epDangerous) {
        int count = epDangerousMapper.updateEpDangerousInfo(epDangerous);
        if (count > 0 ) {
            return true;
        }else{
            return false;
        }
    }

    /*
     *@author zhangtao
     *@Date 2023/4/27
     * 隐患管理(模糊查询隐患)
     */
    @Override
    public List<EpDangerous> getSomeDangerousInfo(String department, Integer riskLevel, String fixStaff, String checkStaff,String startline,String endline) {
        return epDangerousMapper.getSomeDangerousInfo(department,riskLevel,fixStaff,checkStaff,startline,endline);
    }

    @Override
    public List<EpDangerous> getInfoByTime(String startline, String endline) {
        return epDangerousMapper.getInfoByTime(startline,endline);
    }

    @Override
    public List<EpDangerous> getNum() {
        return epDangerousMapper.getNum();
    }

    @Override
    public List<EpDangerous> getEpDangAll(String staffId) {
        return epDangerousMapper.getEpDangAll(staffId);
    }
}
